//#include <file.h>
#include <unistd.h>
#include <stdio.h>
#include <error.h>
#include <fcntl.h>
#include <sys/stat.h>

int main(int c,char **v)
{
	int fd;
	fd = open("./",O_WRONLY|O_APPEND);
	if(fd==-1){
		fd=open("./h",O_WRONLY|O_APPEND|O_CREAT,S_IRUSR|S_IWUSR);	
	}
	if(fd==-1){
		perror("fd is err");
	}
	write(fd,"a",1);
	printf("fd is %d\n",fd);
	char buff[2];
	read(fd,buff,1);
	buff[1]=0;
	printf("%s",buff);
	close(fd);
	return 0;
}

